package Actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.RowSet;

import model.StudentModel;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import db.DbException;

public class addressAction extends Action{
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		
		forms.addressform a = (forms.addressform) form;
		
		request.getSession().setAttribute("street", a.getStreet());
		request.getSession().setAttribute("city", a.getCity());
		request.getSession().setAttribute("lstate", a.getLstate());
		request.getSession().setAttribute("zip", a.getZip());
		request.getSession().setAttribute("areaCode", a.getAreaCode());
		request.getSession().setAttribute("pnumber", a.getPnumber());
		
	    if( request.getSession().getAttribute("citizen").equals("United States") || 
				  request.getSession().getAttribute("citizen").equals("United States Virgin Islands") ){
	    	 request.setAttribute("residency", "U.S. (Domestic Applicant)");
		     return mapping.findForward("usaddress");
	    }
	    else
	    	return mapping.findForward("interaddress");
	}
}